home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 October: Mac OS SDK / Dev.CD Oct 96 SDK / Dev.CD Oct 96 SDK2.toast / Development Kits (Disc 2) / OpenDoc Development Framework / ODF & Cyberdog / CyberStarter / Sources / Frame.cpp < prev    next >
Encoding:
Text File  |  1996-08-16  |  2.3 KB  |  78 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                Frame.cpp
  4. //    Release Version:    $ ODF 1 $
  5. //
  6. //    Copyright:    (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  7. //
  8. //========================================================================================
  9.  
  10. #include "Frame.h"
  11. #include "Part.h"
  12.  
  13. // ----- Framework Includes -----
  14. #include "FWUtil.h"
  15. #include "FWContxt.h"
  16. #include "FWRecShp.h"
  17.  
  18. #ifdef FW_BUILD_MAC
  19. #pragma segment CFrame
  20. #endif
  21.  
  22. FW_DEFINE_AUTO(CFrame)
  23.  
  24. //----------------------------------------------------------------------------------------
  25. //     Standard CFrame Methods
  26. //----------------------------------------------------------------------------------------
  27.  
  28. CFrame::CFrame (Environment* ev, ODFrame* odFrame, FW_CPresentation* presentation, CPart* part)
  29. :    FW_CFrame(ev, odFrame, presentation, part)
  30. ,    fPart (part)
  31. {
  32.     FW_END_CONSTRUCTOR
  33. }
  34.  
  35. CFrame::~CFrame()
  36. {
  37.     FW_START_DESTRUCTOR
  38. }
  39.  
  40. //----------------------------------------------------------------------------------------
  41. //     Cyberdog Support
  42. //----------------------------------------------------------------------------------------
  43.  
  44. void CFrame::Draw (Environment *ev, ODFacet* odFacet, ODShape* invalidShape)
  45. {
  46.     FW_CViewContext fc (ev, this, odFacet, invalidShape);
  47.     FW_CRect invalidRect;
  48.     fc.GetClipRect (invalidRect);
  49.     ::EraseRect (&fc.LogicalToDevice (invalidRect));
  50.     
  51.     DrawUpdate (ev, fc);
  52. }
  53.  
  54. void CFrame::DrawUpdate (Environment *ev, FW_CGraphicContext & gc)
  55. {
  56.     // I call this to draw the content w/o erasing first (avoids flashiness)
  57.     // This is useful during incremental downloads when we only need to display 
  58.     // additional content
  59.     
  60.     // When we're using platform graphics (as opposed to ODF's FWGraphx module) we have
  61.     // to reset things a lot - other parts tend to leave the GrafPort in a random state.
  62.     ::TextFont(1);
  63.     ::TextFace(0);
  64.     ::TextSize(0);
  65.     ::ForeColor (blackColor);
  66.     ::BackColor (whiteColor);
  67.     
  68.     FW_CRect bounds (FW_kZeroPoint, GetSize(ev));
  69.     FW_SPlatformRect pBounds = gc.LogicalToDevice (bounds);
  70.     ::InsetRect (&pBounds, 4, 4);
  71.     ::HLock (fPart->fDownloadedText);
  72.     unsigned long size = GetHandleSize(fPart->fDownloadedText);
  73.     if (size > 32767) size = 32767; // TE can't draw it, but we shouldn't truncate it
  74.     ::TETextBox (*fPart->fDownloadedText, size, &pBounds, teFlushDefault);
  75.     ::HUnlock (fPart->fDownloadedText);
  76. }
  77.  
  78.